package fule.com.playandroidkotlin.ui.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import fule.com.playandroidkotlin.R
import fule.com.playandroidkotlin.ui.model.KnowledgeModel

/**
 * 作者： njb
 * 时间： 2018/8/9 0009-下午 3:43
 * 描述： 知识体系
 * 来源：
 */
class KnowledgeAdapter(data: List<KnowledgeModel.DataBean>?) : BaseQuickAdapter<KnowledgeModel.DataBean, BaseViewHolder>(R.layout.item_knowledge, data) {
    override fun convert(helper: BaseViewHolder, item: KnowledgeModel.DataBean) {
        with(helper) {
            setText(R.id.tv_knowledge_name, item.name)
            item.children.let {

                setText(R.id.tv_knowledge_content, it?.joinToString("    ", transform = { child ->
                    child.name!!
                }))
            }
        }
    }


}